<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>分支语句</title>
  </head>
  <body>
    <script>
      // 1. if 分支
      const age = 18;
      if (age < 18) {
        console.log("未成年");
      } else if (18 <= age <= 25) {
        console.log("成年，但未晚婚");
      } else {
        console.log("到达晚婚年龄");
      }

      // switch 分支 是 === 类型也要相等
      const num = 1;
      switch (num) {
        case "1":
          console.log("吃早饭");
          break;
        case 1:
          console.log("吃午饭");
          break;
        default:
          break;
      }
    </script>
  </body>
</html>
